Macro Editor is the tool which edits the macro-program of LightWayText. Macro is a script which the action of the character input, key operation, menu command describes a series of operation to and to carry out automatically.
Macro of LightWayText is the action of the character input, key operation, menu command described by "Record Key Macro" of Edit - Key Macro menu. And, that is the jump of the macro-inside, a calculation by the variable, the designation of the conditional sentence by the comparison, the indication of input dialog, and so on can describe it.
The made macro is registered for the Key Macro menu, and it can be carried out from the menu. And, the made macro can be assigned to Function key, too.
Macro Editor is indicated when "Macro Editor..." of the Edit - Key Macro menu of LightWayText is carried out.
2. Basic behavior of Macro Editor
When Macro Editor is opened, it becomes new macro editing condition. When a record key macro is carried out in advance, key macro contents are indicated in the Macro Contents listbox. In the Macro Contents listbox, a macro command is indicated in order from No.1, a macro command is decided to be carried out in this number of the order. When a macro command is chosen from New Item popup menu, it is added to the Macro Contents listbox. The right of Macro Editor becomes a macro command editing area, then macro can be edited. It registers for the Key Macro menu when Macro Name is inputted and a "Renewal" button is pushed.
2.1. Macro Name:
The Macro Name which does editing is indicated. When the macro which has already been registered is edited, Macro Name is chosen form popup menu on the right of the editing frame of the Macro Name. When "New Macro" of popup menu is chosen, it becomes new macro preparation. When the Record Key Macro is carried out in advance, key macro contents are indicated in the Macro Contents listbox. Then, a macro name is inputted, and the new macro is registered. When a macro name is changed, the macro is registered with the new name.
2.2. Macro Contents:
A macro command list to edit indicates a listbox. In the Macro Contents listbox, the command carried out is indicated, with a number is stuck in order form 1.
When item of the Macro Contents listbox is chosen, the condition of that macro command is indicated in the right macro command editing area of Macro Editor.
2.3. New Item:
The popup menu of the "New Item" is used, and a macro command is added to the macro command during editing. There are Menu, Enter String, Key Operation, Jump, Label, Variable, Compare, Find, Dialogue, Other in the macro command.
When a New Item is carried out, it is inserted behind chosen item in listbox.
When pushing Shift key and a New Item is carried out, it is inserted in front of chosen item in listbox.
When item of listbox isn't chosen, it is added at the end of the listbox most. Then, when a Shift key is being pushed, it is inserted in the beginning of listbox.
2.4. Edit of Macro Contents Listbox (Cut, Copy, Paste, Clear)
Macro Contents Listbox can be edited by carrying out Cut, Copy, Paste, Clear command form Edit menu. Clear command is carried out with the delete key.
When Paste is carried out, it is inserted behind chosen item in listbox.
When pushing Shift key and Paste is carried out, it is inserted in front of chosen item in listbox.
When item of listbox isn't chosen, it is added at the end of the listbox most. Then, when a Shift key is being pushed, it is inserted in the beginning of listbox.
2.5. Macro Option
An option that the made macro is assigned to Function key and to make not indicate it in the Key Macro menu can be specified.
Function Key
Macro is assigned to Function key from F1 to F15.
Function key is specified by inputting numerical value from 1 to 15.
When a bigger number the 15 is inputted, it isn't carried out.
And, Shift+Function key and Option+Function key can be specified.
Disable Menu View
It is specified not to indicate the macro in Edit - Key Macro menu.
It is used when it wants to set it up only in Function key.
2.6. Read...
File Open Dialog is indicated, and a macro file such as a Macro Sample is read.
When the macro file is read, it registers for the Key Macro menu automatically, and macro contents are indicated on the editing screen of Macro Editor.
2.7. Write...
File Save Dialog is indicated, and the macro during editing is written as a file.
A macro name becomes a file name as it is.
2.8. Renewal
The macro during editing is renewed, Use makes it possible with LightWayText.
In the new macro case, it registers for Key Macro menu with the inputted macro name. And, when a macro name isn't being inputted, it becomes to carry it out in "Execute Key Macro" of the Key Macro menu. When there is a syntax error (the number of the place of a jump and a label don't exist) in the macro during editing, an alert is indicated, and macro modification is suggested.
2.9. Macro Command Editing Area
When item in "Macro Contents" listbox is chosen or "New Item" popup menu is carried out, the condition of that command is indicated in the right macro command editing area of Macro Editor.
3. Explanation of Macro Command
The macro command are Menu, Enter String, Key Operation, Jump, Label, Variable, Compare, Find, Dialogue, Other. And an editing screen varies according to those contents.
3.1. Menu
A menu command is chosen directly form the real menu bar.
Be sure to choose a menu under the condition that a "Macro Contents" listbox is surrounded by bold frame. When there is a cursor in the editing frame of "Macro Name", a menu can't be chosen.
3.2. Enter String
The String which it wants to paste on LightWayText is inputted to the editing frame of the "String". About 10000 characters which contain a line feed code can be inputted.
3.3. Key Operation
The key operation of LightWayText is set up.
Contents:
Cursor Move left, rove Right, Move 1 line up, Move 1 line down
Move left of 1 word, Move right of 1 word, Move head of line
Move end of line, Move 1 page up, Move 1 page down
Move first line, Move last line
Scroll Scroll left, Scroll right, Scroll 1 line up, Scroll 1 line down
Remove Remove left 1 character, Remove right 1 character
Remove left of1 word, Remove right of 1 word
Remove to head of line, Remove until end of line
Remove one line, Undo remove line
Selection
A string selection (the movement of the Shift key) can be specified
for the key operation of the cursor movement.
Count:
The repetition number of time of the key operation is specified.
Numerical value from 1 to 999 can be inputted to the editing frame.
3.4. Jump
It jumps in the Macro Contents listbox, and the divergence of the macro command in done. This jump command is equivalent to the "goto" sentence of the programming language.
Jump [Line#] The line number of the Macro Contents listbox is specified.
Jump [Label] The label name of the place of the jump is specified.
Quit The macro execution is terminated.
Line# or Label: When Jump [Line#] Jump [Label] was specified,
Line# is inputted in the numerical value,
Label name is inputted in the character.
When I want it to jump in the line# of the editing cursor of LightWayText document, it is not this Jump command, "Go To Line#" in Other command is used.
3.5. Label
As for Label, the name of the place of the jump of the jump command, and it is used for the description of the comment in the Macro Contents listbox. A label itself doesn't do treatment.
Label: A character inputs a label name to the editing frame.
3.6. Variable
A variable is used when it wants to hold the calculation of the numerical value and a string during the macro execution. In the variable, there are a string variable and a integer variable, and it can be used respectively to 8 counts.
This variable is used with the command of Compare, Find, Dialogue, Other to explain later.
Subject: Variable (String var 1-8, Integer var 1-8) made the target
of the treatment in specified.
Do it: Treatment toward the variable is specified.
Initialize The contents of the variable are made 0 or null.
Paste The contents of the variable paste on LightWayText.
substitution (=) The variable is substituted for the "Contents" item.
addition (+) The variable is added to the "Contents" item.
subtraction (-) The variable is subtracted in the "Contents" item.
multiplication (*) The variable is multiplied on the "Contents" item.
division (/) The variable is divided by the "Contents" item.
surplus (%) The variable is surplus divided by the "Contents" item.
Contents: Treatment is done as, when treatment object is string variable,
contents are string value, and, when treatment object is integer
variable, contents are integer value.
Nothing Treatment toward the variable isn't done.
String or Integer The string or integer input to editing frame.
Letter of cursor position The letter (character) of cursor position.
String of cursor line The string of cursor line is specified.
String of selection The string of selection is specified.
Line# of cursor position The line # of cursor position is specified.
Letter# of cursor position The letter# of cursor position is specified.
String count of cursor line The string count of cursor line is specified.
Line# of selection end The line # of selection end is specified.
Letter# of selection end The letter# of selection end is specified.
String count of selection The string count of selection is specified.
It is 0 when it isn't selected string.
Line# of last line The last (maximum) line number is specified.
String var 1-8 The string variable 1-8 is specified.
Integer var 1-8 The integer variable 1-8 is specified.
A cursor position is a selection start position (the upper left of the
selection range) at the time of the selection condition.
A selection end position is on the bottom right of the selection range.
When object are string variable and contents are integer value,
it is done as string value at integer value.
When object are integer variable and contents are string value,
it is done as integer value at if string is the character of 0-9, and,
it is done with it as 0 at the time of the string except for it.
3.7. Compare
The treatment of the conditional sentence by the comparison is done during the macro practice. When comparison is right or it is wrong, a jump command can be specified in each.
Subject: The item made the target of the comparison is specified.
Nothing Compare toward the variable isn't done.
Letter of cursor position The letter (character) of cursor position.
String of cursor line The string of cursor line is specified.
String of selection The string of selection is specified.
Line# of cursor position The line # of cursor position is specified.
Letter# of cursor position The letter# of cursor position is specified.
String count of cursor line The string count of cursor line is specified.
Line# of selection end The line # of selection end is specified.
Letter# of selection end The letter# of selection end is specified.
String count of selection The string count of selection is specified.
It is 0 when it isn't selected string.
Line# of last line The last (maximum) line number is specified.
String var 1-8 The string variable 1-8 is specified.
Integer var 1-8 The integer variable 1-8 is specified.
Sign: A condition toward the comparison is specified.
Equal (==) When subject and object is equal.
Differ (!=) When subject and object is differ.
Equal greater than (>=) When subject is equal or greater than object.
Equal less than (<=) When subject is equal or less than object.
Greater than (>) When subject is greater than object.
Less than (<) When subject is less than object.
Object: Compare is done as, when Compare subject is string variable,
object are string value, and, when Compare subject is integer
variable, object are integer value.
Nothing Compare object is specified by 0 value.
String or Integer The string or integer input to editing frame.
Letter of cursor position The letter (character) of cursor position.
String of cursor line The string of cursor line is specified.
String of selection The string of selection is specified.
Line# of cursor position The line # of cursor position is specified.
Letter# of cursor position The letter# of cursor position is specified.
String count of cursor line The string count of cursor line is specified.
Line# of selection end The line # of selection end is specified.
Letter# of selection end The letter# of selection end is specified.
String count of selection The string count of selection is specified.
It is 0 when it isn't selected string.
Line# of last line The last (maximum) line number is specified.
String var 1-8 The string variable 1-8 is specified.
Integer var 1-8 The integer variable 1-8 is specified.
A cursor position is a selection start position (the upper left of the
selection range) at the time of the selection condition.
A selection end position is on the bottom right of the selection range.
When object are string variable and contents are integer value,
it is compare as string value at integer value.
When object are integer variable and contents are string value,
it is compare as integer value at if string is the character of 0-9, and,
it is compare with it as 0 at the time of the string except for it.
Right Compare: When the result of the comparison is right, jump is done.
Nothing Nothing is done.
Jump [Line#] The line number of the Macro Contents listbox is specified.
Jump [Label] The label name of the place of the jump is specified.
Quit The macro execution is terminated.
Wrong Compare: When the result of the comparison is wrong, jump is done.
Nothing Nothing is done.
Jump [Line#] The line number of the Macro Contents listbox is specified.
Jump [Label] The label name of the place of the jump is specified.
Quit The macro execution is terminated.
3.8. Find
The Find can be done by using the string variable during the macro practice.
When find is success or it is failure, a jump command can be specified in each.
Subject: The item made the target of the find is specified.
String A string is inputted to the editing frame.
String var 1-8 The string variable 1-8 are specified. It is looked up
with the contents of the string variable.
Ignore J-Roman letters (Japanese script font only)
Japanese 2 byte roman, 1 byte roman letters is set up
whether it is equated, or it is distinguished.
Ignore J-Kana letters (Japanese script font only)
Japanese hiragana, japanese katakana letters is set up
whether it is equated, or it is distinguished.
Ignore Upper/Lower case
A upper case, lower case (capital letter, small letter)
is set up whether it is equated, or it is distinguished.
Find Backwards It is set up whether it is search in backward direction.
Regular Expression Find by the regular expression is set up.
Refer to "5. Regular Expression" of LightWayText Manual for the details.
Success Find: When the result of the find is success, jump is done.
Nothing Nothing is done.
Jump [Line#] The line number of the Macro Contents listbox is specified.
Jump [Label] The label name of the place of the jump is specified.
Quit The macro execution is terminated.
Failure Find: When the result of the find is failure, jump is done.
Nothing Nothing is done.
Jump [Line#] The line number of the Macro Contents listbox is specified.
Jump [Label] The label name of the place of the jump is specified.
Quit The macro execution is terminated.
3.9. Dialogue
The dialogue of the input of character, integer value which "Input Dialog" was used for, and the message indication by the alert is done. When dialogue is OK or it is Cancel, a jump command can be specified in each.
Input Dialog Input Dialog is specified.
Alert View Alert View is specified.
Message: A message is inputted to the editing frame.
When it isn't inputted, a message indicates the contents of
the string variable specified in the subject as a message.
Subject: The variable that the string inputted with Input Dialog is
stored is specified.
String var 1-8 A string is stored in the string variable.
Integer var 1-8 A integer value is stored in the integer variable.
Dialogue is OK: When dialogue is OK, a jump command is done.
Nothing Nothing is done.
Jump [Line#] The line number of the Macro Contents listbox is specified.
Jump [Label] The label name of the place of the jump is specified.
Quit The macro execution is terminated.
Dialogue is Cancel: When dialogue is Cancel, a jump command is done.
Nothing Nothing is done.
Jump [Line#] The line number of the Macro Contents listbox is specified.
Jump [Label] The label name of the place of the jump is specified.
Quit The macro execution is terminated.
3.10. Other
The treatment of the setup and the acquisition of the condition of LightWayText was arranged as Other commands.
Contents:
Nothing Nothing is done.
Switch Next Window Next window is made the condition of it can be edited.
Switch Prev Window Prev window is made the condition of it can be edited.
The next and previous of the window become the turns of the document
name indicated in the Window menu. When a string variable is specified in
the subject, the window name which specified the contents of the string
variable as a document name is made the condition that it can be edited.
It is made the condition that that document is opened and it can be edited if
the document name list of the Recent menu is referred to and found when
the window of the specified name isn't open.
Go To Line# A line number jumps with the contents of the integer
variable specified in the subject.
Set Document Name The contents of the string variable specified in the
subject are made a document name.
Get Document Name A document name is stored in the string variable
specified in the subject.
Get Today Date A date is stored in the string variable specified in the
subject. When a integer variable is specified in the
subject, it is stored with this form.
(Example) 1998.01.05 (Mon) -> 199801052
The rightmost 1 digit of the value is 1:Sunday,
2:Monday, , ,7:Saturday
Get Now Time A time is stored in the string variable specified in the
subject. When a integer variable is specified in the
subject, it is stored with this form.
(Example) 4 : 25 PM -> 162500
The rightmost 2 digits of the value become from
00 to 59 by the number of second.
Restart Line# A line number starts with the contents of the integer
variable specified in the subject.
Clear Line# A line number is cleared with the contents of the
integer variable specified in the subject.
When nothing is specified in the subject, a line number
start, line number is cleared on the present cursor line
of LightWayText.
Subject: The variable that Other command using is specified.
String var 1-8 The string variable 1-8 is specified.
Integer var 1-8 The integer variable 1-8 is specified.
4. Remove the Registered Macro
When the registered macro is removed from LightWayText, "Define Key Macro..." of the Edit - Key Macro menu is carried out and removed with Define Key Macro Dialog.
5. Macro Creation Example
It is made to explain a macro creation example by the indication form of Macro Contents listbox.
(Example 1) The space at the end of the line is removed.
The macro which removes space code and tab code at the end of all the lines inside the document.
1 Key Operation Move first line
2 Label loop1
3 Find [ \t]+$+R (Failure) Quit
4 Key Operation Remove left 1 character
5 Jump Label: loop1
(Example 2) With the selection string, "Find/Replace..." is carried out.
The macro which makes a selection string a find object by "Find/Replace..."